<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        function fun() {
            var num = 100;
            function foo() {
                console.log('打印' + num);
            }
            return foo;
        }
        fun()();

        function fun1() {
            var num = 20;
            function foo1(newNum) {
                num = newNum;
                console.log(num);

            }
            function getNum() {
                return num;
            }
            return [foo1, getNum]
        }

        var fn3 = fun1();
        console.log(fn3[1]());
        fn3[0](150);
        console.log(fn3[1]());
    </script>
</body>

</html>